<?php
error_reporting(E_ALL ^ E_NOTICE);//没有这句 无refer必输出notice 混在二进制流里影响图片
$url = $_GET["url"];

//$lj1=(strstr($_SERVER['HTTP_HOST'],"localhost") ) || (strstr($_SERVER['HTTP_HOST'],"127.0.0.1"));//本地调试不受影响
 //echo $lj1; echo $lj1==true;
//$lj2=strstr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST']);//限制refer为本站
// echo $lj2;
 
if(strstr($_SERVER['HTTP_REFERER'],"5awo") || strstr($_SERVER['HTTP_REFERER'],"localhost")){
$url = str_replace("https://","http://",$url); 
    $dir = pathinfo($url);
    $host = $dir['dirname'];
    $refer = $host.'/';
    $ch = curl_init($url);
    curl_setopt ($ch, CURLOPT_REFERER, $refer);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
    $data = curl_exec($ch);
    curl_close($ch);
    header("Content-type: image/jpeg");
 
 print_r($data);
    
    }else{
    echo "<h1>403 Forbidden</h1><p>You don't have permission to access the URL on this server.</p>";	  
    	}
?>